Install Glassfish for Deployment on Ubuntu 8.10
As a follow up to my post yesterday, I’m below is a script that will install glassfish for deployment on Ubuntu 8.10. About this script The variables at the beginning are fairly self explanatory: the script works out of $HOME/Development/jruby, and installs to /opt/glassfishv3-prelude - feel free to change these options to suit your needs. In order to install and warble-ize an application, you’ve got to have jruby in your path. The script I posted yesterday will install jruby to the same place this script expects it to be. I’ve tried to document the step that this script takes in the comments - let me know if you think there is anything I should update. At some point, I’ll probably just merge all of this information together into an actual git repository on github so forking/pull requests will be easier.
In the next couple weeks I’ll be posting some follow-ups: deploying typo on glassfish; mysql connection pooling with jdbc; securing glassfish; and whatever else anyone (myself included) finds interesting. Let me know if there is anything you’d like me to cover.
JRuby on Rails on Glassfish on Ubuntu 8.10
I’ve been playing around with JRuby a lot recently, and I decided to see just how hard it would be to develop and deploy a simple web application using JRuby in Ubuntu 8.10. For both development and deployment I’ll be using GlassFish v3 Prelude. For development, I’ve been using the glassfish gem and for deployment, I’ve been using the GlassFish Community Distribtion. I’ll try to run through my development steps today. Tomorrow I’ll post the steps to deploy to a dedicated glassfish server. Development I’ll go through the development steps I’ve been using first. 1. Install JRuby. I’ve been installing JRuby to a development directory and simply adding to my $PATH. The following script installs everything to ~/Development/jruby/ and uses sun-java6-jdk.
2. Install GlassFish gem:
Tomorrow I’ll go over installing a glassfish deployment environment on Ubuntu 8.10.
Ruby Enterprise Edition on Ubuntu 8.10 (x86_64)
This weekend I installed Ruby Enterprise Edition on Ubuntu 8.10. There are numerous posts about Ruby Enterprise Edition and tcmalloc on a 64-bit platform, but Phusion have said that it still won’t build. Well, I made some simple changes to the installer and Ruby Enterprise Edition now builds and runs on my Ubuntu 8.10 servers with tcmalloc. See the changes to the installer and the steps to install Ruby Enterprise Edition below.
Patch used to install Ruby Enterprise Edition:
Steps to install Ruby Enterprise Edition:
First, download Ruby Enterprise Edition from Phusion:
wget http://rubyforge.org/frs/download.php/47937/ruby-enterprise-1.8.6-20081205.tar.gz tar xzvf ruby-enterprise-1.8.6-20081205.tar.gz
Next, apply this patch to Ruby Enterprise Edition (Edit: updated patch):
wget http://gist.github.com/raw/33313/b556fae6a2f1a48c6acea0f350af0f1017efd379 -O patch.diff cd ruby-enterprise-1.8.6-20081205 patch -p1 -E < ../patch.diff
Now simply build and Ruby Enterprise Edition as you would normally. Configure Passenger (mod_rails, mod_rack) to use the new Ruby Enterprise Edition.
/opt/ruby-enterprise-1.8.6-20081205/bin/passenger-install-apache2-module
Don’t forget to make the appropriate changes to your apache.conf.
Wake-on-lan and the Intrepid Ibex
I’ve been using Tomato on my WRT54GL for some time. I recently decided to start keeping my servers off most of the time and instead use the built in wake-on-lan functionality of tomato. I had previously set up Ubuntu 8.04.1 with wake-on-lan, but there are some minor differences for Ubuntu 8.10 (the Intrepid Ibex).
- Install ethtool.
sudo apt-get install ethtool
- Add a file to /etc/init.d.
sudo vim /etc/init.d/wakeonlanconfig
The contents of the file should be as follows:
Note the “eth0” used above. If you’re using a different interface for wake-on-lan, substitute appropriately.
- Configure the file you added in step 2 to run at boot.
sudo update-rc.d -f wakeonlanconfig defaults
- Run the file you created in step 2.
sudo /etc/init.d/wakeonlanconfig
- Change /etc/init.d/halt so the network interfaces aren’t halted when the computer is shut down. At the top of the file, change this line:
NETDOWN=yes
to the following:
NETDOWN=no
That’s it! From now on, every time you shut down your computer you can use the WOL interface from Tomato to wake it up.
Leopard, AFP and the Intrepid Ibex
Seeing as Intrepid will be out in a number of days, I wanted to update my previous post on installing netatalk on Ubuntu with SSL support. The steps remain pretty much the same for Ubuntu 8.10 (Intrepid Ibex). As I mentioned, It’s easy enough to allow Leopard to use plaintext passwords with the following command:
$defaults write com.apple.AppleShareClient afp_cleartext_allow -bool true
You can use the following instructions to download and build netatalk on Hardy (you must have the Universe repository enabled in /etc/apt/sources.list):
$ mkdir -p ~/src/netatalk $ cd ~/src/netatalk $ sudo apt-get install devscripts cracklib2-dev dpkg-dev libssl-dev build-essential $ sudo apt-get build-dep netatalk $ apt-get source netatalk $ cd netatalk-2.0.3 $ DEB_BUILD_OPTIONS=ssl dpkg-buildpackage -us -uc $ sudo debi
Netatalk is now properly installed, but there are two tweaks i suggest. First, tell dpkg not to upgrade netatalk:
$ echo "netatalk hold" | sudo dpkg --set-selections
Second, I always edit /etc/default/netatalk to set the following:
ATALKD_RUN=no PAPD_RUN=no
Disabling atalkd and papd mean Netatalk will start much faster. I don’t know anyone that uses atalkd or papd anymore, so it’s worth looking into.
You should now be able to connect from Leopard to your Intrepid home directory!
Watching MerbCamp
I’m watching MerbCamp and the Jets game right now.
Install Mysql Gem on Leopard
sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/opt/local/bin/mysql_config5
Migrated over to SliceHost
I finally migrated my blog from MediaTemple over to SliceHost. Things have been running much better, and the blog is much easier to maintain from my perspective.
Leopard, AFP and the Hardy Heron
Damon Timm has a great post on installing netatalk on Ubuntu with SSL support. I won’t go through the licensing issues again (I feel like enough people have done that already). Suffice to say, Ubuntu doesn’t ship netatalk with SSL enabled, and Leopard requires SSL support to connect to AFP shares out of the box. It’s easy enough to allow Leopard to use plaintext passwords with the following command:
defaults write com.apple.AppleShareClient afp_cleartext_allow -bool true
I just felt it would be a better idea to enable SSL by default on Hardy.This, as they say, is where things get tricky. First, the version of netatalk in Hardy is broken (see discussion of the bug in Debian here). There are one of two ways to fix this, simply hand-edit the offending patch, or use the source packages provided by Debian. With this in mind, you can use the following instructions to download and build netatalk on Hardy (keeping in mind, as Damon mentions, you must have the Universe repository enabled in /etc/apt/sources.list):
$ mkdir -p ~/src/netatalk $ cd ~/src/netatalk $ sudo aptitude install devscripts cracklib2-dev dpkg-dev libssl-dev build-essential $ sudo apt-get build-dep netatalk $ apt-get source netatalk
Edit: the current version in Hardy is now 2.0.3-9. The patch is no longer necessary. If you choose to use the apt-get source line above, you should hand-edit the offending patch (that is until the MOTU update netatalk from version 2.0.3-7 to 2.0.3-8). Below is a diff containing the only change necessary:
--- netatalk-2.0.3/debian/patches/107_afpd-zeroconf.patch
2007-12-21 21:53:43.000000000 +0100
+++ netatalk-2.0.3.new/debian/patches/107_afpd-zeroconf.patch
2007-12-21 21:56:52.000000000 +0100
@@ -350,7 +350,7 @@
+{
+ struct context *ctx = userdata;
+
-+ assert(g == ctx->group);
++ assert(!ctx->group || g == ctx->group);
+
+ switch (state) {
+
At this point you’re free to continue building netatalk. EDIT: sudo su isn’t necessary with the new version of the package.
NB: the instructions below differ from Damon’s because building with an environment variable before “sudo” when envreset is set in sudoers (the default behavior in Hardy) makes your efforts useless! You should sudo su before creating the build rather than building with sudo (unless you don’t mind the potential security risk of removing envreset from sudoers)
$ cd netatalk-2.0.3 $ DEB_BUILD_OPTIONS=ssl dpkg-buildpackage -us -uc $ sudo debi
You should now be able to connect from Leopard to your Hardy Heron home directory!
GlobalSAN iSCSI Initiator and Leopard
I’ve spent the last several days messing with the GlobalSAN iSCSI initiator on Leopard, and long story short, it doesn’t work very well at all. Numerous hardlocks (on the order of 5 minutes after beginning a long-ish read/write operation).
I managed to get my Ubuntu Hardy Heron box set up with iSCSI, mounted the Thecus with hfsplus, and got my data off that way. I’ll be posting more information on my iSCSI setup under ubuntu, as well as how I’m putting together the MythTV box.
In other news I took the plunge and got the PeepCode unlimited special for Ruby on Rails programming screencasts. I’m actually really liking the screencasts, despite the fact I have a fair amount of rails experience.
Hopefully I can follow some of this up tomorrow.